let p1 = {
  name: "",
  age: 18,
  gender: "male",
};

class TestTypeOf {
  name: string
}

//先定义变量，再定义类型
let p11 = {
  name: "树哥",
  age: 18,
  gender: "male",
};
type People = typeof p11;
function getName(p: People): string {
  return p.name;
}
getName(p1);


export function testTypeOf() {
  let obj = new TestTypeOf()
  let Type1 = typeof obj
  // function test(type : Type1){} 这里编译报错，提示Type1是一个值，不能用作类型 'Type1' refers to a value, but is being used as a type here. Did you mean 'typeof Type1'? <ArkTSCheck>

  let p11 = {
    name: "树哥",
    age: 18,
    gender: "male",
  };
  type People = typeof p11;
  function getName(p: People): string {
    return p.name;
  }

}

type T1 = ConstructorParameters<new (x: string, y: number) => object>; // [x: string, y: number]

type T2 = ConstructorParameters<
new (x?: string) => object
>; // [x?: string | undefined]
